#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
	string s;
	cout<<"A: "<<(int)'A'<<" a: "<<(int)'a'<<endl;
	cout<<(ll)pow(2,31)-1<<endl;
	while (cin>>s) {
		int hash=0;
		for (int i=0; i<s.length(); ++i) hash=hash*31+s[i];//-(s[i]>='A'&&s[i]<='Z'? 'A': 'a');
		cout<<hash<<endl;
	}
	return 0;
}
